package com.matrix.java.chap_04;

import java.util.Scanner;

/*
    财务应用：酬金
 */
public class Ex4_23 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter employee' s name: ");
        String name = input.next();
        System.out.print("Enter number of hours worked in a week: ");
        double hours = input.nextInt();
        System.out.print("Enter hourly pay rate: ");
        double payRate = input.nextDouble();
        System.out.print("Enter federal tax withholding rate: ");
        double federalTax = input.nextDouble();
        System.out.print("Enter state tax withholding rate: ");
        double stateTax = input.nextDouble();

        System.out.printf("%s%s\n", "Employee Name: ", name);
        System.out.printf("%s%.1f\n", "Hours Worked: ", hours);
        System.out.printf("%s%s%.2f\n", "Pay Rate: ", "$", payRate);
        System.out.printf("%s%s%.1f\n", "Gross Pay: ", "$", payRate * hours);
        System.out.printf("%s", "Deductions:");
        System.out.printf("%s%s%.2f\n", " Federal Withholding (20.0%): ", "$", payRate * hours * federalTax);
        System.out.printf("%s%s%.2f\n", " State Withholding (9.0%): ", "$", payRate * hours * stateTax);
        System.out.printf("%s%s%.2f\n", " Total Deduction: ", "$", payRate * hours * stateTax + payRate * hours * federalTax);
        System.out.printf("%s%s%.2f\n", "Net Pay: ", "$", payRate * hours - payRate * hours * stateTax - payRate * hours * federalTax);
        input.close();
    }
}
